PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPWaitForEvent

Retrieves event flags from a specified event group.

OSStatus MPWaitForEvent (
                     MPEventID event,
                     MPEventFlags *flags,
                     Duration timeout);
event
A value of type MPEventID that specifies the event group whose flags you want to retrieve.
flags
A pointer to a 32-bit variable of type MPEventFlags . On return, the variable contains the flags of the specified event group. Pass NULL if you do not need any flag information.
timeout
A value of type Duration that specifies the maximum time to wait for events before timing out. See Timer Duration Constants for a list of constants you can use to specify the wait interval.
function result
A result code. See Result Codes for a list of possible values.
DISCUSSION

This function obtains event flags from the specified event group. The timeout specifies how long to wait for events if none are present when the call is made. If any flags are set when this function is called, all the flags in the event group are moved to the flag field and the event group is cleared. This obtaining and clearing action is an atomic operation to ensure that no updates are lost. If multiple tasks are waiting on an event group, only one can obtain any particular set of flags.

If you call this function from a cooperative task, you should specify only kDurationImmediate for the timeout length; other waits will cause the task to block.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.

SEE ALSO

The function MPSetEvent .


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)